package com.graduate.game.assignment.service;

import com.graduate.game.assignment.mapper.assignmentMapper;
import com.graduate.game.assignment.mapper.recordMapper;
import com.graduate.game.assignment.pojo.record;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class recordServiceImpl implements recordService {

    @Autowired
    public recordMapper recordmapper;
    @Override
    public boolean insert(record record) {
        int x = recordmapper.insertRecord(record);
        if(x>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public List<record> getreRecordsByID(String getuser) {
        List<record> records = recordmapper.getbyidRecords(getuser);
        return records;
    }

    @Override
    public record getoneRecord(int assginid) {
        return recordmapper.getOneRecordByID(assginid);
    }

    @Override
    public boolean updateRecord(record record) {
        int x = recordmapper.updateRecord(record);
        if(x>0){
            return true;
        }else {
            return false;
        }
    }

    @Override
    public List<record> getrecordsbypulishRecords(String publisher) {
        return recordmapper.getByPulisher(publisher);
    }

    @Override
    public boolean updatestate(record record) {
        int x = recordmapper.updateState(record);
        if(x>0){
            return true;
        }else {
            return false;
        }
    }
}
